package hbnu.stockManage.model;
import java.lang.Object;
import java.util.Objects;

public class Product {
    private int id;
    private String name;
    private Double price;
    private int stock;

    public Product() {}
    public Product(int id, String name, Double price, int stock) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.stock = stock;
    }
    public void setId(int id){this.id = id;}
    public int getId(){return id;}

    public void setName(String name){this.name = name;}
    public String getName(){return name;}

    public void setPrice(Double price){this.price = price;}
    public Double getPrice(){return price;}

    public void setStock(int stock){this.stock = stock;}
    public int getStock(){return stock;}

    @Override
    public boolean equals(Object o){
        if(this ==o) return true;
        if(o == null || getClass() != o.getClass()) return false;
        Product product = (Product) o;
        return id == product.id;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return "Product{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", stock=" + stock +
                '}';
    }
}
